/*
 * Created on Oct 22, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.hermeneute.fsa;

/**
 * @author mauceri
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class FSTSequentialSmallCompiledState implements FSTSequentialCompiledState {

	/* (non-Javadoc)
	 * @see com.hermeneute.fst.FSTSerialCompiledState#nextState(char)
	 */
	int idx1;
	int idx2;
	FSTCompiledTransition ct1;
	FSTCompiledTransition ct2;
	
	FSTSequentialSmallCompiledState (FSTTransition t1, FSTTransition t2,int idx[]){
		idx1 = idx[t1.getEvent().getIn()];
		idx2 = idx[t2.getEvent().getIn()];
		ct1 = new FSTCompiledTransition (
				t1.getState(),t1.getEvent().getOut());
		ct2 = new FSTCompiledTransition (
				t2.getState(),t2.getEvent().getOut());
	}
	
	public FSTCompiledTransition nextState(int input) {
		//System.out.println("idx1 = "+idx1+", idx2 = "+idx2+", input small = "+input);
		if (input == idx1){
			return ct1;
		}else if (input == idx2){
			return ct2;
		}else{
			return null;
		}
	}

	/* (non-Javadoc)
	 * @see com.hermeneute.fst.FSTSequentialCompiledState#getType()
	 */
	public int getType() {
		// TODO Auto-generated method stub
		return FSTSequentialCompiledState.SMALL_STATE;
	}

}
